Skip to content

fix: Groq Content Parts, Fixups Refactor, and Gemini Caching#103

Merged
monoxgas merged 2 commits into
mainfrom
fix/groq-content-parts
May 16, 2025
Merged

fix: Groq Content Parts, Fixups Refactor, and Gemini Caching#103
monoxgas merged 2 commits into
mainfrom
fix/groq-content-parts

Conversation

@monoxgas

@monoxgas monoxgas commented May 15, 2025

Copy link
Copy Markdown
Contributor

Notes

  • Refactored fixup mechanics for generators to better support single round use
  • Above should fix caching not applying for larger conversations if they start small in Gemini
  • Corrected behaviors for Groq content parts not being pure text.

Generated Summary

  • Updated Fixup class to allow can_fix method to return a type of bool | t.Literal["once"] instead of just bool, enhancing its functionality to indicate if a fix can be applied only once.
  • Introduced the with_fixups decorator to streamline the application of fixups with persistent state management, improving the retry logic in async functions.
  • Removed the previous Fixups dataclass usage in the Generator class, simplifying the error handling mechanism.
  • Implemented CacheTooSmallFixup and GroqAssistantContentFixup classes, which provide specific error-handling strategies for their respective cases.
  • Refactored _generate_message method in LiteLLMGenerator to use the new with_fixups decorator, improving readability and maintainability.
  • Enhanced the Message class to support compatibility flags, allowing dynamic handling of message content types for better API interactions.
  • General code cleanup and removal of outdated methods related to fixup checking and application, leading to a leaner codebase.

This summary was generated with ❤️ by rigging

Generated Summary

Summary of changes related to enhancing fixup functionality and compatibility handling.

  • Introduced a new decorator with_fixups for applying fixup logic with persistent state to asynchronous functions.
  • Updated the can_fix method in Fixup to optionally return a literal indicating the fix can be applied "once".
  • Removed the Fixups data class and instead integrated the fixup logic directly into methods using the decorator.
  • Implemented specific fixups like CacheTooSmallFixup and GroqAssistantContentFixup with tailored can_fix and fix methods.
  • Enhanced Message class to include compatibility flags, allowing messages to adapt content format based on API requirements.
  • Removed obsolete fixup management methods from the Generator class.
  • Simplified _generate_message method to utilize new with_fixups decorator, streamlining error handling while generating messages.

Potential impacts:

  • This change modernizes how fixups are processed, promoting a more flexible approach to error handling.
  • Compatibility handling allows better integration with various APIs, potentially minimizing errors during message generation.
  • The removal of unused methods helps to clean up the codebase, improving maintainability.

This summary was generated with ❤️ by rigging

@monoxgas monoxgas requested a review from a team as a code owner May 15, 2025 08:18
@monoxgas monoxgas merged commit 16a80fd into main May 16, 2025
5 checks passed
@monoxgas monoxgas deleted the fix/groq-content-parts branch May 16, 2025 05:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant